{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
    <form class="layui-form gg-form-bar border-t border-x">

        <div class="layui-input-inline" style="width:300px;">
            <input type="text" name="keywords" placeholder="昵称/手机号" class="layui-input" autocomplete="off" />
        </div>
        <div class="layui-input-inline">
            <select name="type">
                <option value="">会员类型</option>
                <option value="1">微信</option>
                <option value="2">支付宝</option>
            </select>
        </div>

        <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">搜索</button>
    </form>
    <table class="layui-hide" id="users" lay-filter="users"></table>
</div>


<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <!--<button class="layui-btn layui-btn-normal layui-btn-sm add-menu">+ 新建账号</button>-->
    </div>
</script>
<script type="text/html" id="barDemo">
    <div class="layui-btn-group">

        <!--<a class="layui-btn layui-btn-xs" lay-event="pay">手动充值</a>
        -->
        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
         <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
</script>
<script type="text/html" id="status">
    <i class="layui-icon {{#  if(d.status == 1){ }}layui-icon-ok{{#  } else { }}layui-icon-close{{#  } }}"></i>
</script>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
    const moduleInit = ['tool'];
    function gouguInit() {
        var table = layui.table,tool = layui.tool, form = layui.form;
        layui.pageTable = table.render({
            elem: '#users',
            title: '会员列表',
            toolbar: '#toolbarDemo',
            url: '/webadmin/users/index', //数据接口
            page: true, //开启分页
            limit: 20,
            cols: [
                [ //表头
                    {
                        field: 'id',
                        title: 'id',
                        align: 'center',
                        width: 120
                    }, {
                    field: 'nickname',
                    title: '昵称',
                    width: 160
                },{
                    field: 'mobile',
                    title: '手机号',
                    width: 120
                }, {
                    field: 'openid',
                    title: 'openid',
                    width: 150,
                } ,{
                    field: 'usertype',
                    title: '类型',
                    width: 150,
                } ,{
                    field: 'createip',
                    title: '注册IP',
                    width: 100,
                },{
                    field: 'login_num',
                    title: '登录次数',
                    align: 'center',
                    width: 100,
                },{
                    field: 'status',
                    title: '状态',
                    toolbar: '#status',
                    align: 'center',
                    width: 100,
                },  {
                    field: 'createtime',
                    title: '注册时间',
                    fixed: 'right',
                    align: 'center'
                }
                ]
            ]
        });


        //监听搜索提交
        form.on('submit(webform)', function(data) {
            layui.pageTable.reload({
                where: {
                    keywords: data.field.keywords,
                    type: data.field.type,
                },
                page: {
                    curr: 1
                }
            });
            return false;
        });
    }
</script>
{/block}
<!-- /脚本 -->
